<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>write</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_001_014_2904">&nbsp;</a>NAME</h4><blockquote>
write - write to another user
</blockquote><h4><a name = "tag_001_014_2905">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

write <i>user_name </i><b>[</b><i>terminal</i><b>]</b>
</code>
</pre>
</blockquote><h4><a name = "tag_001_014_2906">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>write</i>
utility reads lines from the user's standard input and
writes them to the terminal of another user.
When first invoked, it writes the message:
<pre>
<code>
<b>Message from </b><i>sender-login-id</i> (<i>sending-terminal</i>) <b>[</b><i>date</i><b>]</b>...
</code>
</pre>
to
<i>user_name</i>.
When it has successfully
completed the connection,
the sender's terminal will be alerted twice
to indicate that what the sender is typing
is being written to the recipient's terminal.
<p>
If the recipient wants to reply, this can be accomplished by typing:
<pre>
<code>
write <i>sender-login-id </i><b>[</b><i>sending-terminal</i><b>]
</b></code>
</pre>
upon receipt of the initial message.
Whenever a line of input as delimited by a NL, EOF or EOL special
character (see
the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b>&nbsp;</a> )
is accumulated
while in canonical input mode, the accumulated data
will be written on the other user's terminal.
Characters are processed as follows:
<ul>
<p>
<li>
Typing the
alert
character will write the
alert
character to the recipient's terminal.
<p>
<li>
Typing the erase and kill
characters will affect the sender's terminal
in the manner described by the
<b>termios</b>
interface in
the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b>&nbsp;</a> .
<p>
<li>
Typing the interrupt or end-of-file characters will cause
<i>write</i>
to write an appropriate message
(EOT\n
in the POSIX locale)
to the recipient's terminal and exit.
<p>
<li>
Typing characters from LC_CTYPE classifications
<b>print</b>
or
<b>space</b>
will cause those characters to be sent to the recipient's terminal.
<p>
<li>
When and only when the
<i><a href="stty.html">stty</a></i>
<i>iexten</i>
local mode
is enabled,
the existence and processing of
additional special control
characters and
multi-byte or single-byte functions is implementation-dependent.
<p>
<li>
Typing other non-printable characters
will cause implementation-dependent sequences of
printable characters to be written to the recipient's terminal.
<p>
</ul>
<p>
To write to a user who is logged in more than once,
the
<i>terminal</i>
argument can be used to indicate which terminal
to write to;
otherwise, the recipient's terminal
is selected in an implementation-dependent manner and
an informational message will be written
to the sender's standard output,
indicating which terminal was chosen.
<p>
Permission to be a recipient of a
<i>write</i>
message can be denied or granted by use of the
<i><a href="mesg.html">mesg</a></i>
utility.
However, a user's privilege may further constrain
the domain of accessibility of other users' terminals.
The
<i>write</i>
utility will fail when the user lacks the appropriate privileges
to perform the requested action.
</blockquote><h4><a name = "tag_001_014_2907">&nbsp;</a>OPTIONS</h4><blockquote>
None.
<br>
</blockquote><h4><a name = "tag_001_014_2908">&nbsp;</a>OPERANDS</h4><blockquote>
The following operands are supported:
<dl compact>

<dt><i>user_name</i><dd>
Login name of the person to whom the message will be written.
This operand must be of the form returned by the
<i><a href="who.html">who</a></i>
utility.

<dt><i>terminal</i><dd>
Terminal identification in the same format provided by the
<i><a href="who.html">who</a></i>
utility.

</dl>
</blockquote><h4><a name = "tag_001_014_2909">&nbsp;</a>STDIN</h4><blockquote>
Lines to be copied to the recipient's
terminal will be read from standard input.
</blockquote><h4><a name = "tag_001_014_2910">&nbsp;</a>INPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2911">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>
The following environment variables affect the execution of
<i>write</i>:
<dl compact>

<dt><i>LANG</i><dd>Provide a default value for the internationalisation variables
that are unset or null.
If
<i>LANG</i>
is unset or null, the corresponding value from the
implementation-dependent default locale will be used.
If any of the internationalisation variables contains an invalid setting, the
utility will behave as if none of the variables had been defined.

<dt><i>LC_ALL</i><dd>
If set to a non-empty string value,
override the values of all the other internationalisation variables.

<dt><i>LC_CTYPE</i><dd>
Determine the
locale for the interpretation of sequences of bytes of text data as
characters (for example, single- as opposed to multi-byte characters
in arguments and input files).
If the recipient's locale does not use an LC_CTYPE equivalent to the
sender's, the results are undefined.

<dt><i>LC_MESSAGES</i><dd>
Determine the locale that should be used to affect
the format and contents of diagnostic
messages written to standard error
and informative messages written to standard output.

<dt><i>NLSPATH</i><dd>
Determine the location of message catalogues
for the processing of
<i>LC_MESSAGES .
</i>
</dl>
</blockquote><h4><a name = "tag_001_014_2912">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>
If an interrupt signal is received,
<i>write</i>
will write an appropriate message on the recipient's
terminal and exit with a status of zero.
It will take the standard action for all other signals.
</blockquote><h4><a name = "tag_001_014_2913">&nbsp;</a>STDOUT</h4><blockquote>
An informational message will be written to standard output
if a recipient is logged in more than once.
</blockquote><h4><a name = "tag_001_014_2914">&nbsp;</a>STDERR</h4><blockquote>
Used only for diagnostic messages.
</blockquote><h4><a name = "tag_001_014_2915">&nbsp;</a>OUTPUT FILES</h4><blockquote>
The recipient's terminal will be used for output.
</blockquote><h4><a name = "tag_001_014_2916">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>
None.
<br>
</blockquote><h4><a name = "tag_001_014_2917">&nbsp;</a>EXIT STATUS</h4><blockquote>
The following exit values are returned:
<dl compact>

<dt>0<dd>Successful completion.

<dt>&gt;0<dd>The addressed user is not logged on or
the addressed user denies permission.

</dl>
</blockquote><h4><a name = "tag_001_014_2918">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_2919">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
The
<i><a href="talk.html">talk</a></i>
utility is considered by some users to be a more
usable utility on full-screen terminals.
</blockquote><h4><a name = "tag_001_014_2920">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2921">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
The IEEE PASC 1003.2 Interpretations Committee has forwarded concerns about
parts of this interface definition to the IEEE PASC Shell and Utilities Working Group
which is identifying the corrections.
A future revision of this specification will align with
IEEE Std. 1003.2b when finalised.
</blockquote><h4><a name = "tag_001_014_2922">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="mesg.html">mesg</a></i>,
<i><a href="talk.html">talk</a></i>,
<i><a href="who.html">who</a></i>,
the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b>&nbsp;</a> .
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
